home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / manage / snmp / kip / doc / broadcast next >
Encoding:
Text File  |  1989-01-17  |  15.9 KB  |  343 lines

  1. IP BROADCASTING ISSUES
  2.  
  3. This note attempts to explain some of the peculiarities of internet (IP)
  4. broadcast addressing, and how these relate to the setup of the KIP
  5. code.  Topics covered include:
  6.  
  7.     Broadcasts and 'directed' broadcasts.
  8.     Appletalk broadcast addresses.
  9.     Appletalk NBP use of broadcast.
  10.     IP address formats.
  11.     IP broadcast formats.
  12.     Sample atalkatab database files.
  13.  
  14.  
  15. BROADCASTS AND DIRECTED BROADCASTS
  16.  
  17. For every protocol family (IP, Appletalk, ISO, etc.) the basic packet
  18. datagram contains source and destination address fields.  The source
  19. address is always set to the address of the machine (host) sending the
  20. packet.  The destination address is usually set to the address of a
  21. specific single host that is to receive the packet.
  22.  
  23. However there are a limited number of cases in which we wish ALL hosts
  24. on a given cable to receive a copy of the packet.  For example one may
  25. not know the address on which a particular service resides, so a
  26. request packet can be sent to all hosts on that cable;  then only those
  27. service hosts which want to, will reply.
  28.  
  29. The addresses used in the packet datagram for source and destination
  30. always contains a 'net number' field (or part) and a host number field
  31. or part.  The host number field has a special distinguished value to
  32. indicate that this is a broadcast address.  Typically this value is all
  33. ones (e.g. hex FF...) or (less prefered) all zeros.
  34.  
  35. When sending a broadcast packet, if the net number of the sender is the
  36. same as the net number in the destination address field, then this
  37. broadcast is a 'local' broadcast where the sender and receivers are on
  38. the same physical cable.  In this case the sender will pass the packet
  39. to the physical layer driver with an indication that it is to be
  40. broadcast on the local cable.
  41.  
  42. But these protocol families operate in an 'internetworked' environment
  43. where each physical cable has different net number in the address.
  44. It may be that we wish to perform a broadcast, not to the local cable 
  45. (network number), but to a network several bridge hops away.  In this
  46. case the destination net number field will differ from the source
  47. net number.  This is called a directed broadcast.
  48.  
  49. The original sender of a directed broadcast recognizes that the net
  50. number of the destination address differs from its own local net
  51. number.  So it forwards this packet to the 'bridge' (router or gateway)
  52. on the local cable.  The bridges will then forward the packet to each
  53. other until it reaches a bridge on the destination cable.  That bridge
  54. will then pass the packet to the physical layer driver with an
  55. indication that it is to be broadcast on the cable.
  56.  
  57.  
  58. APPLETALK BROADCAST ADDRESSES
  59.  
  60. Appletalk addresses are very simple.  There is a 16 bit net number
  61. and an 8 bit host number.  The host number 'all ones' (hex FF) indicates
  62. a broadcast address.
  63.  
  64.  
  65. APPLETALK NBP USE OF BROADCAST
  66.  
  67. The appletalk protocol family contains a protocol 'NBP', Name Binding
  68. Protocol.  Appletalk 'names' are ascii strings used to locate a named
  69. resource, such as a LaserWriter or file server.  An appletalk name
  70. consists of three parts, written as 'object:type@zone'.  The 'type'
  71. might be 'LaserWriter' or 'fileserver'.  'Object' is used to
  72. differentiate a particular instance of that resource type.  'Zone' is a
  73. concept used to limit the name search to only a subset of all the
  74. cables that makeup an Appletalk internetwork.
  75.  
  76. When an appletalk client wishes to perform a name to address lookup
  77. operation, it formats a request packet containing the name string and
  78. then sends this to the closest bridge on the local cable.  The bridge
  79. has an internal table (routing table) showing the net number, zone name,
  80. and next hop address for each cable in the appletalk internetwork.
  81.  
  82. The bridge takes the client lookup request and sends a copy, a directed
  83. broadcast, to each net (cable) in the referenced zone.  Thus each
  84. client NBP lookup turns into a flurry of directed broadcasts reaching
  85. every host in that zone.  The destination host who has internally
  86. registered the name being looked up, will reply to the lookup client,
  87. and the transaction will be complete.
  88.  
  89.  
  90. IP ADDRESS FORMATS
  91.  
  92. Internet protocol (IP) addresses are 32 bits in length (4 bytes) and
  93. are typically written in 'dot notation', with each byte of the address
  94. in decimal (0 to 255) separated by dots.  For example, '36.44.0.123'.
  95.  
  96. IP addresses do not contain a fixed size net number part and a fixed
  97. size host number part, thus they are not as simple to parse as
  98. appletalk addresses.  Rather the size of the net number part of the
  99. address depends on the upper bits of the first byte of the IP address.
  100. The net number part can be one, two or three bytes in length.  This
  101. corresponds to IP 'address class' A, B, and C, respectively.   The
  102. table below (from RFC791, Internet Protocol Specification) shows the
  103. class types based on the high order bits of the first byte.
  104.  
  105.     Class    High bits    Format
  106.     A    0        7 bits of net, 24 bits of host
  107.     B    10        14 bits of net, 16 bits of host
  108.     C    110        21 bits of net, 8 bits of host
  109.  
  110.  
  111. IP BROADCAST FORMATS (THE 'PROBLEM')
  112.  
  113. It is most straightforward in implementing the appletalk NBP services
  114. to map the appletalk directed broadcasts into corresponding IP directed
  115. broadcasts.  Ah.  Now we come to the problem.  A standard for IP
  116. broadcasting was written in 1984:  RFC919, Broadcasting Internet
  117. Datagrams;  and RFC922, Broadcasting Internet Datagrams in the Presence
  118. of Subnets;  both by Jeff Mogul.  However only a few of the many IP
  119. 'vendors' in the real world are in compliance with this spec.  (4.3 BSD
  120. UNIX does comply).
  121.  
  122.   Basically RFC919/922 says that a broadcast address consists of the
  123.   normal 'net part' plus 'all ones' in the 'host part'.  So a class B
  124.   broadcast address might be 128.111.255.255 (two bytes of net number
  125.   and two bytes of host number); a class C might be 192.22.3.255 (three
  126.   bytes net number and one byte host number).
  127.  
  128.   When 'subnets' are involved (with a class B or A net number) some
  129.   subsection of the 'host part' becomes the 'subnet number'.  For
  130.   example 128.111.2.67 could be refering to net 128.111, subnet 2, host
  131.   67.  For situations like this, the broadcast version just replaces
  132.   the final host part with all ones.  So the broadcast address for
  133.   cable (subnet) 2 would be 128.111.2.255.
  134.  
  135.   Finally RFC919/922 allows the use of a 'local broadcast only' address
  136.   (255.255.255.255), when the sending machine does not know its own
  137.   network number and simply wishes to send to all hosts on the local
  138.   cable.
  139.  
  140. Unfortunately 4.2 BSD was released prior to RFC919/922.  4.2 BSD
  141. arbitrarily chose 'all zeros' for the host part as indicative of a
  142. broadcast address.  And 4.2 BSD had no provision for generating or
  143. recognizing subnet broadcast addresses.  Since a number of 'vendor'
  144. products were adaptations of the 4.2 code, this convention is more
  145. widespread than one would imagine.
  146.  
  147. As long as all the hosts on your ethernet use the same IP broadcasting
  148. conventions, you are ok.  But during the next year or so, you may end
  149. up with a mix of the old (4.2) and new (4.3) conventions.  The problem
  150. is that the host receiving a 'wrong' broadcast does not recognize it as
  151. such.  This means (1) processes on that host can not receive
  152. broadcasts.  (2) if the host is silly enough to try 'forwarding' this
  153. broadcast packet, it will in turn initiate an ARP broadcast request
  154. (address resolution protocol) packet searching for this address.  Of
  155. course no one will respond, but this generates extra needless traffic.
  156. If several hosts are misbehaving like this, pileups and collisions can
  157. occur on your ethernet cable.  (3) Some hosts even generate ICMP error
  158. packets if they receive an unrecognized broadcast.
  159.  
  160. The answer for #1 and 3 is to convince your vendors to come into
  161. compliance with RFC919/922 ASAP.  We also give some 'temporary'
  162. solutions in the next section below.  For case #2, we suggest turning
  163. off 'forwarding' in workstations that only have one network interface.
  164. For example this can easily be done in 4.2/4.3 BSD by patching the
  165. 'ipforwarding' kernel variable to zero, using adb.
  166.  
  167. As you can imagine, this lack of IP broadcasting standards is causing
  168. grief in other communities as well.  Below we reprint some recent
  169. traffic on the 'tcp-ip' bboard.  Phil Karn suggests an even easier
  170. criterion for recognizing broadcast packets.
  171.  
  172. > Date: Tue, 3 Feb 87 20:10:24 EST
  173. > From: karn@jupiter.bellcore.com (Phil R. Karn)
  174. > To: tcp-ip@nic.sri.com
  175. > Subject: Inappropriate responses to broadcasts
  176. > Some time ago, there was discussion about IP implementations which
  177. > respond inappropriately to broadcast packets.  A number of solutions
  178. > were offered, the best one (in my opinion) being a flag to tell IP when
  179. > a packet was received on a hardware broadcast address so that it would
  180. > not try to forward it or respond to it with an ICMP message.
  181. > Since then, there seems to have been virtually no progress among the
  182. > vendors in implementing these fixes. Here at Bellcore we run a rather
  183. > large network consisting of Ethernets at several locations bridged
  184. > together with DEC LanBridge 100's and Vitalink Translan-3s.  With so
  185. > many hosts on the same "virtual Ethernet", from time to time broadcast
  186. > packets with bogus IP addresses are bound to appear.  Right now there
  187. > is one Microvax running Ultrix 1.2 that has its netmask set improperly.
  188. > A single rwho packet from that machine triggers literally HUNDREDS (as
  189. > counted with my Excelan Lanalyzer) of ARP requests.  This represents
  190. > practically every host on the network!!  I cringe to think that before
  191. > long many more of our machines will be running 4.3 BSD-derived code
  192. > that allows the setting of the IP broadcast address to any bogus value
  193. > the heart desires.
  194. > At Uniforum in DC the other week I played with the Lanalyzer at the
  195. > Excelan booth. Guess what? Most of the packets on the net were ARP
  196. > requests because of one machine that didn't have its IP broadcast
  197. > address set right!  I felt right at home.  At least I now know what to
  198. > say the next time a vendor tells me "get our latest release and then
  199. > call me back".
  200. > If something more formal than the TCP-IP archives is needed to get the
  201. > vendors to act, I hereby volunteer to write the RFC.  I would require
  202. > that the link or subnet pass a "multicast" bit to IP indicating when an
  203. > incoming packet is received on a hardware broadcast or multicast
  204. > address.  If this bit is set, IP must refuse to forward the packet or
  205. > answer it with an ICMP message.  It should also refuse to pass the
  206. > packet up to TCP, should its protocol ID appear in the header.
  207. > Naturally, the multicast bit would always be zero for packets received
  208. > on non-broadcast and point-to-point subnets.
  209. > Since there are so many incompatible conventions for IP broadcast
  210. > addresses, I suggest that they be done away with altogether.  Since
  211. > gateways never forward broadcasts, the IP destination address in a
  212. > broadcast UDP packet has no real meaning and should be ignored.  The
  213. > fact that the packet was sent to the hardware broadcast address should
  214. > be enough to say "this is a broadcast packet".
  215. > Phil
  216. > Date:     Sat, 7 Feb 87 23:02:16 EST
  217. > From: Mills@UDEL.EDU
  218. > To: "Phil R. Karn" <karn%jupiter.bellcore.com@UDEL.EDU>
  219. > Cc: tcp-ip@sri-nic.arpa
  220. > Subject:  Re:  Inappropriate responses to broadcasts
  221. > Phil,
  222. > The fuzzball gateways used on the NSFNET Backbone, among other places,
  223. > incorporate a "martian filter" that grounds packets for the various IP
  224. > braodcast addresses, as well as other reserved addresses (see RFC-990).
  225. > At least one other gateway system (cisco) allegedly does the same. As
  226. > you know from my previous messages to this list, gateways that forward
  227. > IP broadcast packets can creat astonishing mischief in quite surprising
  228. > places.
  229. > Your suggestion on a mechanism to prevent forwarding of multicast
  230. > packets was suggested to the INENG Task Force some time back; however,
  231. > implementation in the various Unix bsd's hasn't happened yet. See also
  232. > the appendix to RFC-985 for further suggestions. Your comments and
  233. > advice on the issues raised there would be welcome.
  234. > Dave
  235.  
  236.  
  237. SAMPLE ATALKATAB DATABASE FILES
  238.  
  239. Below we list several common cases that may arise in setting up your
  240. /etc/atalkatab file.
  241.  
  242. (1) If all your hosts comply with RFC919/922, you simply use the N1, N2 or
  243. N3 flags to setup the appropriate broadcast address used by your site.
  244. This example shows class C addresses and the N1 flag.  Dots '..' show
  245. uninteresting fields.
  246.  
  247.     1.33    N1    192.22.33.0    ZZ    #ether cable, west
  248.     2.1    KC    192.22.33.12    ZZ    #appletalk, chemlab
  249.         I192.22.33.255    ..        #ipbroad
  250.         ..
  251.         S2.1    S1.33    "ZZ"        #atneta atnete zone
  252.  
  253. The next example is similar to the above but shows a subnetted class B net,
  254. where '33' is the subnet number.  Above, '33' was just the third byte
  255. of the three byte class C net number.  Here the net number is only
  256. two bytes (128.22) and 33.xx is actually the host part.  However this
  257. campus adopts the convention that the third byte is a subnet number.
  258. Additionally some other ether cables are shown.
  259.  
  260.     1.34    N1    128.22.34.0    ZZ    #ether cable, south
  261.     1.33    N1    128.22.33.0    ZZ    #ether cable, west
  262.     2.1    KC    128.22.33.12    ZZ    #appletalk, chemlab
  263.         I128.22.33.255    ..        #ipbroad
  264.         ..
  265.         S2.1    S1.33    "ZZ"        #atneta atnete zone
  266.  
  267. (2) If all your hosts are using 4.2 conventions, then here is a class C
  268. example that would be similar to yours.
  269.  
  270.     1.33    N0    192.22.33.0    ZZ    #ether cable, west
  271.     2.1    KC    192.22.33.12    ZZ    #appletalk, chemlab
  272.         I192.22.33.0    ..        #ipbroad
  273.         ..
  274.         S2.1    S1.33    "ZZ"        #atneta atnete zone
  275.  
  276. Here is an unusual case.  This is a class B site with subnets, but with
  277. only 4.2 hosts.  I.e. these 4.2 hosts can only recognize a class B
  278. broadcast address of the form 128.X.0.0;  the host (subnet number) must
  279. be zero.  The solution is to use the 'H' flag for the ether cables, and
  280. to point those nets to kboxes on the same cable.  The 'ipbroad' value
  281. in the kbox config can then be setup to use any arbitrary broadcast
  282. address on the local ether cable.
  283.  
  284.     1.33    H    128.22.33.12    ZZ    #ether cable, west
  285.     2.1    KC    128.22.33.12    ZZ    #appletalk, chemlab
  286.         I128.22.0.0    ..        #ipbroad
  287.         ..
  288.         S2.1    S1.33    "ZZ"        #atneta atnete zone
  289.  
  290.     1.34    H    128.22.34.66    ZZ    #ether cable, south
  291.     2.2    K    128.22.34.66    ZZ    #appletalk, chemlab
  292.         I128.22.0.0    ..        #ipbroad
  293.         ..
  294.         S2.2    S1.34    "ZZ"        #atneta atnete zone
  295.  
  296. The 'H' flag for appletalk nets on ether cables is useful in a number
  297. of cases when your IP internetwork is not in compliance with
  298. RFC919/922.  The way it works is as follows:
  299.  
  300.   (a) When a kbox wishes to send a directed broadcast to that net, it
  301.   sends the packet to the IP address (following the H), wrapped in a
  302.   UDP header with the destination port set to a certain 'magic' socket
  303.   number.  When the kbox (or UNIX atalkrd server) receives this UDP
  304.   packet, it rebroadcasts it (or resends it to an arbitrary list of
  305.   addresses) on that cable.  A basic requirement is that the IP address
  306.   used with H must be on the SAME CABLE as the net being refered to.
  307.   This is because a kbox, when used as a redirect server, simply
  308.   broadcasts the packet to the 'ipbroad' configured address.
  309.  
  310.   (b) When a kbox wishes to send a plain packet (NOT a directed
  311.   broadcast) to that net, it forms the IP address by stripping the low
  312.   byte from the H IP address, and ORing in the appletalk node number.
  313.   This is another reason that the IP address must be on the same
  314.   cable as the net being refered to.
  315.  
  316.   (c) So, if the ether cable you are refering to with the H flag does
  317.   not happen to have a kbox also on the same cable, you must point the
  318.   H net to a UNIX host running atalkrd on that cable.
  319.  
  320. Examples of when you might need to use the H flag could be:
  321.  
  322.   (a) Your main campus IP gateways can't pass IP directed broadcasts.
  323.   Here you should be able to use kboxes or atalkrd as rebroadcasters.
  324.   If you need to use atalkrd, you can just give it the appropriate
  325.   broadcast address for the local cable.
  326.  
  327.   (b) You have a mix of old and new format broadcast addresses.  Here
  328.   you have a choice.  If you have MOSTLY one format, you can just
  329.   choose to ignore the other format (not all your UNIX hosts need to be
  330.   running CAP/EFS/PAPIF).  Or you can use the atalkrd daemon and give
  331.   it a specific list of hosts on that cable to reforward to.
  332.